#pragma once

#include <Poco/Logger.h>
#include <Poco/Util/AbstractConfiguration.h>
#include <Poco/Util/Application.h>
#include <stdarg.h>
#include <stdint.h>

#include <iostream>
#include <string>

#include "Poco/AutoPtr.h"
#include "Poco/FileChannel.h"
#include "Poco/Format.h"
#include "Poco/FormattingChannel.h"
#include "Poco/PatternFormatter.h"

namespace keeper_server {

#define LOG_MAX 10240

void loggerInitiation(const std::string& log_file);

std::string getMessage(const char* Format, ...);


#define LOG_TRACE(Format, ...)                                           \
  Poco::Logger::get("keeper_server")                                     \
      .trace(keeper_server::getMessage(Format, ##__VA_ARGS__), __FILE__, \
             __LINE__)

#define LOG_DEBUG(Format, ...)                                           \
  Poco::Logger::get("keeper_server")                                     \
      .debug(keeper_server::getMessage(Format, ##__VA_ARGS__), __FILE__, \
             __LINE__)

#define LOG_INFO(Format, ...)                                                  \
  Poco::Logger::get("keeper_server")                                           \
      .information(keeper_server::getMessage(Format, ##__VA_ARGS__), __FILE__, \
                   __LINE__)

#define LOG_NOTICE(Format, ...)                                           \
  Poco::Logger::get("keeper_server")                                      \
      .notice(keeper_server::getMessage(Format, ##__VA_ARGS__), __FILE__, \
              __LINE__)

#define LOG_WARN(Format, ...)                                              \
  Poco::Logger::get("keeper_server")                                       \
      .warning(keeper_server::getMessage(Format, ##__VA_ARGS__), __FILE__, \
               __LINE__)

#define LOG_ERROR(Format, ...)                                           \
  Poco::Logger::get("keeper_server")                                     \
      .error(keeper_server::getMessage(Format, ##__VA_ARGS__), __FILE__, \
             __LINE__)

#define LOG_FATAL(Format, ...)                                           \
  Poco::Logger::get("keeper_server")                                     \
      .fatal(keeper_server::getMessage(Format, ##__VA_ARGS__), __FILE__, \
             __LINE__)
}  // namespace keeper_server
